package com.innotek.testworkstation.config;


import lombok.extern.slf4j.Slf4j;

import java.io.File;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;

/**
 * @ClassName Constant
 * @Description 常量类
 * @Author wangx
 * @Date 2021/7/8 下午2:40
 * @Version 1.0
 **/

@Slf4j
public class Constant {
    /*常用的常量*/
    public static final String LINE = "\r\n";

    public static final String TAB = "\t";

    public static final String EMPTY = "";

    public static final String COMMA = ",";

    public static final String UNKNOW = "?";

    public static final String OR = "/";

    public static final String PART = "|";

    /*项目分类*/
    public static final String PROJECT_WEB = "web";
    public static final String PROJECT_POS = "pos";

    /** 请求终端来源 */
    public static final String SOURCE_WEB = "OPERATOR_PORTAL_PC";
    public static final String SOURCE_POS = "POS_ANDROID";

    /*设置测试用例key*/
    public static final String RESPONSEPATH = "responsePath";
    public static final String EXPECT = "expect";
    public static final String MATCHER = "matcher";

    /**
     * 读写配置文件过滤的文本
     */
    public static final String DEFAULT_STRING = "GregTester";

    /**
     * 配置文件名称,相对与classes路径
     */
    public static final String DEFAULT_CONFIG = "/config.properties";


    /**
     * 本地缓存失效时间（秒）
     */
    public static final Long EXPIRE_TIME= 600L;


    /**
     * 请求返回值
     */
    public static final String RES_MSG_TRUE= "处理成功";



    /**
     * 校验IP+port的正确性
     */
    public static final String HOST_REGEX = "((25[0-5]|2[0-4]\\d|((1\\d{2})|([1-9]?\\d)))\\.){3}(25[0-5]|2[0-4]\\d|((1\\d{2})|([1-9]?\\d))):([0-9]|[1-9]\\d{1,3}|[1-5]\\d{4}|6[0-4]\\d{4}|65[0-4]\\d{2}|655[0-2]\\d|6553[0-5])";

    /**
     * UTF-8字符编码格式
     */
    public static final Charset UTF_8 = StandardCharsets.UTF_8;

    /**
     * 默认字符集
     */
    public static Charset DEFAULT_CHARSET = UTF_8;

    /**
     * 当前工作目录
     */
    public static final String WORK_SPACE = new File(EMPTY).getAbsolutePath() + "/";

    /**
     * 日志存存储目录
     */
    public static final String LOG_Path = WORK_SPACE + "log/";


}
